/**
 * This file is part of AppStoreBot.
 *
 * AppStoreBot is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * AppStoreBot is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AppStoreBot.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package lu.pragmaconsult.appstorebot;

/**
 * 
 * Every exit code status with an associated comment that is the displayed
 * output by the Bot.
 * 
 * @author Wilfried Vandenberghe (wilfried.vandenberghe at pragmaconsult.lu)
 */
public enum ExitStatus {
	/**
	 * Execution finish with success.
	 */
	COMPLETE("Execution completed", 0),

	/**
	 * Authentication failure
	 */
	AUTHENTICATION_FAILURE("Authentication failed", 1),

	/**
	 * Failure caused for any reason
	 */
	FAILURE(
			"Unable to load the sales report web page at this time. A number of reasons can cause this including delayed reporting, unsigned contracts, and change to the web site breaking this script. Try again later or sign into iTunes Connect and verify access.",
			1);

	/**
	 * Status message.
	 */
	private String message;

	/**
	 * Exit code. 0 is considered as successful.
	 */
	private int returnCode;

	/**
	 * Build an exit status from a message and a status code.
	 * 
	 * @param message
	 *            status message
	 * @param returnCode
	 *            status code
	 */
	private ExitStatus(String message, int returnCode) {
		this.message = message;
		this.returnCode = returnCode;
	}

	/**
	 * Get status message.
	 * 
	 * @return status message
	 */
	public String getMessage() {
		return message;
	}

	/**
	 * Get bot return code.
	 * 
	 * @return bot return code
	 */
	public int getReturnCode() {
		return returnCode;
	}

}
